import javax.swing.*;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class nerea extends JFrame implements ActionListener {

	private JMenuBar mainMenuBar;					//Bara de Menu
	private JMenu mainMenuBarFile;				//Menu File
	private JMenu mainMenuBarHelp;				//Menu Help
	
	private JPanel cabecera;
	private JButton boton;
	private JTabbedPane tabs;
	
	private Container myCont;
	public nerea(){
		
		mainMenuBar = new JMenuBar();				//Crea la barra de Menu
		mainMenuBarFile = new JMenu("File");		//Crea menu File
		mainMenuBarHelp = new JMenu("Help");		//Crea menu Help
		
		mainMenuBarFile.setMnemonic('F');			//Shortcut File
		mainMenuBarHelp.setMnemonic('H');			//Shortcut Help
		
		mainMenuBar.add(mainMenuBarFile);			//Agrega File a MenuBar
		mainMenuBar.add(mainMenuBarHelp);			//Agrega Help a MenuBar
		
		cabecera = new JPanel(new FlowLayout(FlowLayout.CENTER)); //Crea la cabecera
		
		boton = new JButton("Login");		//Crea el boton
		boton.addActionListener(this);		//Agrega gestor de evento
		cabecera.add(boton);				//Agrega el boton a la cabecera
		
		
		myCont = this.getContentPane();				//Crea el panel de la ventana
		myCont.setLayout(new BorderLayout());		//define un layout
		myCont.add(cabecera,BorderLayout.NORTH);	//La cabecera va al norte
		
		
	}
	
	//Main
	
	public static void main(String[] args) {
		nerea app = new nerea();
		app.showWindow();
		
	}
	
	public void showWindow(){
		this.setTitle("Herlich willkommen");
		this.setJMenuBar(mainMenuBar);
		this.setSize(400,200);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setUndecorated(true);													
		this.setLocationRelativeTo(null);											
		this.getRootPane().setWindowDecorationStyle(JRootPane.QUESTION_DIALOG);	
		this.setJMenuBar(mainMenuBar);
		this.setVisible(true);
	}
	//Gestor de eventos
	public void actionPerformed(ActionEvent e) {
		myCont.add(crearTabs(),BorderLayout.CENTER);  //El tabPanel al centro
		
	}

	//Crea el tabPanel
	public JTabbedPane crearTabs(){
		JLabel label = new JLabel("Panel 1");
		JLabel label2 = new JLabel("Panel 2");
		tabs = new JTabbedPane();
		tabs.addTab("Tab 1", null, label);
		tabs.addTab("Tab 2", null, label2);
		return tabs;
	}
}